package com.springboot.mybatis.controller;

import com.springboot.mybatis.entity.User;
import com.springboot.mybatis.service.collectiondemo.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author sunyt
 * @date 2020/7/14 14:20
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;


    @GetMapping(value = "/show")
    public String show() {
        return userService.show();
//        return "Hello World!";
    }



/*    @RequestMapping(value="/insert")
    public String insert(String name, int age) {
        return userService.insert(name, age);
    }*/

    @PostMapping(value="/insert")
    public String insert(@RequestBody User user){
        return userService.insert(user);
    }


    @RequestMapping(value = "/select")
    public Object select(int age) {
        return userService.select(age);
    }
}
